/**
 * KAYO APPLIANCE CHAINS.
 * Copyright (c) 2016-2016 All Rights Reserved.
 */
package com.leku.mse.dao.impl.member;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.leku.commons.datasource.DataSourceClient;
import com.leku.mse.dao.member.FavoriteDao;
import com.leku.mse.entity.FavoriteEntity;

/**
 * 功能描述: 收藏数据服务
 *
 * @author suiying
 * @created 2017年5月26日
 * @version 1.0.0
 */
@Repository
public class FavoriteDaoImpl implements FavoriteDao {

    @Autowired
    private DataSourceClient dataSourceClient;

    /*
     * (non-Javadoc)
     * @see com.leku.memcenter.dao.favorite.FavoriteDao#insertFavorite(com.leku.memcenter.entity.FavoriteEntity)
     */
    @Override
    public int insertFavorite(FavoriteEntity favorite) {

        return dataSourceClient.insert("favoriteDao.insertFavorite", favorite);
    }

    /*
     * (non-Javadoc)
     * @see com.leku.memcenter.dao.favorite.FavoriteDao#deleteFavorite(java.lang.String, java.lang.String,
     * java.lang.String, java.lang.String)
     */
    @Override
    public int deleteFavorite(String memberCode, String relaCode, String relaType, String appCode) {
        Map<String, Object> param = new HashMap<String, Object>();

        param.put("memberCode", memberCode);
        param.put("relaCode", relaCode);
        param.put("relaType", relaType);
        param.put("appCode", appCode);

        return dataSourceClient.update("favoriteDao.deleteFavoriteByRela", param);
    }

}
